<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">

    <form class="layui-form" action="" method="post">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">公告内容(300字)</label>
            <div class="layui-input-block">
                <textarea style="height:300px;width:400px" name="content" id="content" placeholder="请输入内容" lay-verify="required" class="layui-textarea" maxlength="300"></textarea>
            </div>
        </div>

        <div class="layui-inline" style="height:70px">
            <label class=" layui-form-label ">播放间隔</label>
            <div class="layui-input-inline ">
                <input style="width:100px" type="text" name="timeInterval" id="timeInterval" lay-verify="required|number" autocomplete="off" class="layui-input" value="">
            </div>
            <label>秒</label>
        </div>
        <div class="layui-inline" style="height:70px">
            <label class=" layui-form-label">重复次数</label>
            <div class="layui-input-inline">
                <input style="width:100px" type="text" name="repeat" id="repeat" lay-verify="required|number" autocomplete="off" class="layui-input" value="">
            </div>
            <label>秒</label>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="sub">确定</button> &nbsp&nbsp&nbsp&nbsp
                <button type="reset" class="layui-btn layui-btn-primary">清空</button>
            </div>

        </div>

    </form>
    <div class="layui-input-block ">
        <button class="layui-btn layui-btn-primary " lay-submit="" lay-filter="returnBtn">返回</button> &nbsp&nbsp&nbsp&nbsp
    </div>
</div>
<script>
    var $;
    layui.config({
        base: "js/ "
    }).use(['form', 'element', 'layer', 'jquery'], function() {
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        var $ = layui.jquery;
        var role_ids = [];


        form.on('submit(returnBtn)', function(data) {
            window.location.href = "list"
        });

        form.on('submit(sub)', function(data) {

            var form_data = $("form ").serialize();



            $.post('[|urlfor "SysGamenoticeController.Add"|]', form_data, function(out) {
                if (out.status == 0) {
                    layer.alert('添加成功(' + out.message + ')', {
                        title: '信息提示：'
                    })

                } else {
                    layer.alert("添加失败，ERR:" + out.message, {
                        title: '信息提示：'

                    })
                }
            }, "json");




            return false;
        });

        //但是，如果你的HTML是动态生成的，自动渲染就会失效
        //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
        //form.render();
    });
</script>